Javarifier: Inferring Reference Immutability for Java 6.883: Program Analysis Course Project

نویسندگان

  • Vineet Sinha
  • Matthew Tschantz
  • Chen Xiao
چکیده

Reference immutability constraints restrict certain references in a program from modifying objects. These constraints, such as those provided by the Javari programming language, have been shown to increase the expressiveness of a language and to prevent and detect errors. Unfortunately, annotating existing code, including libraries, with reference immutabil­ ity constraints is a tedious and error prone task. We propose an algorithm for inferring the references in a pro­ gram that can be declared as read­only (or romaybe). Addi­ tionally, to gain additional precision, we introduce heuristics that suggest assignable and mutable fields. To evaluate our algorithm, we have implemented a tool, Javarifier, to aid programmers in converting Java programs to Javari. We also demonstrate the practicality of our algo­ rithm by using Javarifier to annotate an existing program.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Inference of Reference Immutability

Javari is an extension of Java that supports reference immutability constraints. Programmers write readonly type qualifiers and other constraints, and the Javari typechecker detects mutation errors (incorrect side effects) or verifies their absence. While case studies have demonstrated the practicality and value of Javari, a barrier to usability remains. A Javari program will not typecheck unle...

متن کامل

Immutable Objects in Java

Immutability is a very useful and desirable property for objects. This paper investigates different possible notions of immutability for Java objects, to find out which notion is the most intuitive and useful, both when it comes to ways of enforcing immutability of objects, and when it comes to exploiting information about (im)mutability of objects in program verification and in various static ...

متن کامل

Immutability: An Empirical Study in Scala

Utilizing immutability is considered to have many desired benefits when it comes to software development and reasoning about programs. It is also one of the core principles of functional programming, and many programming languages have support for specifying immutability. Developers can by specifying immutability write code that, for example, prevent program state from being unintentionally mut...

متن کامل

Immutable Objects for a Java-Like Language

We extend a Java-like language with immutability specifications and a static type system for verifying immutability. A class modifier immutable specifies that all class instances are immutable objects. Ownership types specify the depth of object states and enforce encapsulation of representation objects. The type system guarantees that the state of immutable objects does not visibly mutate duri...

متن کامل

Towards Unifying Immutability and Ownership

Immutability is a highly requested feature missing from the mainstream object-oriented languages. Boyland [2] argues that immutability cannot be introduced into a language without additional aliasing-prone mechanisms such as ownership (or fractional permissions). Rather than providing support for both of these important features independently [8, 6, 1], we explore the possibility of unifying th...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2005